﻿Imports System.Net.Mail

Partial Class Pages_MailTest
    Inherits System.Web.UI.Page

    Protected Sub odesli_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles odesli.Click
        Dim mail As New Emails
        Dim adkomu As MailAddress = New MailAddress(komu.Text)
       
        Dim Msg As New MailMessage()
        Dim Senderx As New SmtpClient()

        Msg.From = New MailAddress("admin@horejsi.cz", "Web Hořejší")
        Msg.Subject = predmet.Text
        Msg.Body = textmail.Text


        Msg.To.Add(adkomu)
        Msg.IsBodyHtml = True
        Msg.Priority = MailPriority.High

        Try
            Senderx.Send(Msg)
        Catch ex As Exception
            result.Text = ex.InnerException.ToString
        End Try
       
    End Sub
End Class
